package com.bgt.springboot.first.controller;

import com.bgt.springboot.first.dao.UserCopyMapper;
import com.bgt.springboot.first.model.UserCopy;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/userc/")
public class IndexController {

    @Autowired
    private UserCopyMapper userCopyMapper;

    @GetMapping(value = "/getId/{id}")
    public UserCopy getById(@PathVariable Integer id){

        return userCopyMapper.getById(id);
    }
    @GetMapping(value = "/insert")
    public Integer insert(){
        UserCopy e=new UserCopy();
        e.setId(4);
        e.setAge(17);
        return userCopyMapper.insert2(e);
    }
    @RequestMapping(value = "/list")
    public UserCopy list(@RequestParam(value="ids[]") Long[] id){

        System.out.println("-----------------");

        return new UserCopy();
    }
    @PostMapping(value = "/list4")
    public String list4(@RequestParam(value="ids[]") Long[] ids){

        System.out.println("---------444--------");

        return "成功了";
    }
    @RequestMapping(value = "/list3")
    public UserCopy list3(){

        System.out.println("-----------------");

        return new UserCopy();
    }
    @PostMapping(value = "/list2")
    public UserCopy list(@RequestBody BatchData batchdatas){

        System.out.println("-----------------");

        return new UserCopy();
    }
}
